import java.util.Scanner;

class Persion{
	private String name;
	private boolean gender;
	private int age;
	private int id;
	
	
	public Persion(){
		System.out.println("This is constructor");
		System.out.println(name+","+age+","+gender+","+id);
	}

	@Override
	public String toString() {
		return "Person [name=" + name + ", age=" + age +", gender=" + gender +  ", id=" + id + "]";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean iGender() {
		return gender;
	}

	public void setGender(boolean gender) {
		this.gender = gender;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	 
	 public Persion(String name,int age,boolean gender){
			setName(name);
			setGender(gender);
			setAge(age);
		 }
}


public class Main {
	
	public static void main(String[] arge)
	{
		Scanner in=new Scanner (System.in);
		int n=in.nextInt();
		Persion[] person=new Persion[n];
		for(int i=0;i<n;i++){
			String name = in.next();			
			int age=in.nextInt();
			boolean gender=in.nextBoolean();
			person[i]=new Persion(name,age,gender);
		}
		for(n=n-1;n>=0;n--)
		{
			System.out.println(person[n]);
		}
		Persion per=new Persion();
		System.out.println(per);
	}	
}	
	

